﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using EasyStudy.Logic;

namespace EasyStudy.UI
{
    public partial class CtrlTodoTask : UserControl
    {
        public CtrlTodoTask()
        {
            InitializeComponent();

        }

        public EbbinghausTask Task
        {
            get { return _task; }
        }

        public CtrlTodoTask(Logic.EbbinghausTask task)
            : this()
        {
            _task = task;
            txtSubject.Text = task.Subject;
            txtComment.Text = task.Comment;
            //dateTimePicker.Value = task.NextTime;
            Tag = task.ID;
        }

        public void SetFinishStatus()
        {
            panel1.BackColor = Color.Lime;
            txtComment.BackColor = Color.Lime;
            txtSubject.BackColor = Color.Lime;
            tableLayoutPanel1.BackColor = Color.Lime;
        }

        public event EventHandler UpdateTask
        {
            add
            {
                this.btnFinish.Click += value;
            }
            remove
            {
                this.btnFinish.Click -= value;
            }
        }

        private EbbinghausTask _task;

        private void btnFinish_Click(object sender, EventArgs e)
        {
            btnFinish.Visible = false;
        }
    }
}
